home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2000 September / maximum-cd-2000-09.iso / Vampire the Masquerade / vampire_demo.exe / Codex.nob / ItemUtilityTorch.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-22  |  1.5 KB  |  43 lines

  1. public class ItemUtilityTorch extends Codex {
  2.    int flameGuid;
  3.  
  4.    public void CreateTorch() {
  5.       CodexThing torch = new CodexThing(((Codex)this).GetClassThing());
  6.       this.flameGuid = torch.SpawnThing("torchFlame_nosave");
  7.       int boneNum = torch.FindBone(34);
  8.       float[] offset = new float[3];
  9.       offset = torch.FindBoneOffset(34);
  10.       torch.AttachThing(this.flameGuid, boneNum, offset, 1);
  11.    }
  12.  
  13.    public void beginscene(int clientGuid, int captureID) {
  14.       CodexItem torch = new CodexItem(((Codex)this).GetClassThing());
  15.       if ((torch.GetItemFlags() & 2097152) != 0) {
  16.          this.CreateTorch();
  17.       }
  18.  
  19.    }
  20.  
  21.    public void endscene(int clientGuid, int captureID, int exitNum) {
  22.       this.DestroyTorch();
  23.    }
  24.  
  25.    public boolean unworn(int guid, int wearerGuid, int captureId) {
  26.       this.DestroyTorch();
  27.       return true;
  28.    }
  29.  
  30.    public void DestroyTorch() {
  31.       if (this.flameGuid != 0) {
  32.          CodexThing flame = new CodexThing(this.flameGuid);
  33.          flame.Remove();
  34.          this.flameGuid = 0;
  35.       }
  36.  
  37.    }
  38.  
  39.    public void worn(int guid, int wearerGuid, int captureId) {
  40.       this.CreateTorch();
  41.    }
  42. }
  43.